package com.ztesoft.sca.service.user;

import com.ztesoft.sca.dao.user.ImUserDao;
import com.ztesoft.sca.model.user.ImPrivilegePo;
import com.ztesoft.sca.model.user.ImUserPo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liang.aozhao
 * @created 2018/5/15 21:14
 */
@Service
public class ImUserServiceImpl implements ImUserService{

    private static final Logger logger = LoggerFactory.getLogger(ImUserServiceImpl.class);

    @Autowired
    ImUserDao imUserDao;

    @Override
    public long addImUser(ImUserPo imUserPo) throws Exception {
        return imUserDao.addImUser(imUserPo);
    }

    @Override
    public void deleteImUser(ImUserPo imUserPo) throws Exception {
        imUserDao.deleteImUser(imUserPo);
    }

    @Override
    public void updateImUser(ImUserPo imUserPo) throws Exception {
        imUserDao.updateImUser(imUserPo);
    }

    @Override
    public ImUserPo getImUser(ImUserPo imUserPo) throws Exception {
        return imUserDao.getImUser(imUserPo);
    }

    @Override
    public List<ImUserPo> listImUsersByRoleId(Long roleId) throws Exception {
        return imUserDao.listImUsersByRoleId(roleId);
    }

    @Override
    public List<ImUserPo> listImUserByOrgId(Long orgId) throws Exception {
        return imUserDao.listImUserByOrgId(orgId);
    }

    @Override
    public void addImUserRoleRela(Long userId, Long roleId) throws Exception {
        imUserDao.addImUserRoleRela(userId,roleId);
    }

    @Override
    public void deleteImUserRoleRela(Long userId, Long roleId) throws Exception {
        imUserDao.deleteImUserRoleRela(userId,roleId);
    }

    @Override
    public List<ImPrivilegePo> listImPrivilegeByUserId(Long userId) throws Exception {
        return imUserDao.listImPrivilegeByUserId(userId);
    }
}
